/*
 * 
 *
 *  
 *      
 */
#ifndef _DRV_I2C_H_
#define _DRV_I2C_H_

#include <stm32f4xx.h>
#include <stm32f4xx_gpio.h>
#include <stdint.h>

#define  ERR_NONE      0
#define  ERR_ACK       1
#define  ERR_PARA       2

#define  DRV_I2C_OPWR    0
#define  DRV_I2C_OPRD    1

#define I2C_PERIOD    20    //12

void i2c_delay_us(uint32_t t);
void drv_i2c_init (void);
void drv_i2c_start (void);
void drv_i2c_stop (void);
int8_t  drv_i2c_writebyte (uint8_t txByte);
uint8_t drv_i2c_readbyte (uint8_t ackflag);
uint8_t drv_i2c_select_dev (uint8_t addr, uint8_t optype);

#endif
